package com.my.cd.visitor;

/**
 * 雇员对象，一般是属性不太变化的对象<br/>
 * 但是对于属性的行为经常需要变化，适用访问者模式
 */
public class Employee extends Element {

    private String name;
    private Integer age;

    public Employee() {
    }

    public Employee(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    /**
     * 双重指派
     */
    @Override
    void accept(Visitor visitor) {
        visitor.visit(this);
    }
}
